import Vue from "vue";
import Router from "vue-router";

import example from "./module/example"; // example模块
import redirect from "./module/redirect"; // 重定向页面模块

let routes = [
  ...example,
  ...redirect
]

Vue.use(Router);

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes,

  // 记录浏览器上一个路由的滚动条位置
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) return savedPosition;
    else return {
      x: 0,
      y: 0
    }
  }
})